const app = getApp();
Page({
  data: {
    tatle:'',
    hiringList: [],
    jobList: []
  },
  findJob() {
    wx.navigateTo({
      url: '/pages/findJob/findJob'
    });
  },
  postJob() {
    wx.navigateTo({
      url: '/pages/postJobOpenings/postJobOpenings'
    });
  },
  search(){
    let url = app.globalData.URL + '/jobPostings/getListPostings';
    console.log(url);
    let data = {
      "jobTitle":this.data.tatle
    };
    app.wxRequest('GET', url, data, (res) => {
      console.log("fdsf====>",data);
      this.setData({
        hiringList:res.data
      })
    }, (err) => {
      console.log(err.errMsg)
    })
  },
  onLoad: function() {
    let url = app.globalData.URL + '/jobPostings/getListPostings';
    let data = {
      "jobTitle":this.data.tatle
    };
    app.wxRequest('GET', url, data, (res) => {
      console.log('Data===>',res);
      this.setData({
        hiringList:res.data
      })
    }, (err) => {
      console.log(err.errMsg)
    });
    let url1 = app.globalData.URL + '/jobApplications/getListApplications';
    let data1 = {
      "user_id":app.globalData.user.userId
    };
    app.wxRequest('GET', url1, data1, (res) => {
      console.log(res);
      this.setData({
        jobList:res.data
      })
    }, (err) => {
      console.log(err.errMsg)
    })
  },
  qiuZhi(){
    let url = app.globalData.URL + '/jobApplications/getListApplications';
    let data = {
      "user_id":app.globalData.user.userId
    };
    app.wxRequest('GET', url, data, (res) => {
      console.log(res);
      this.setData({
        jobList:res.data
      })
    }, (err) => {
      console.log(err.errMsg)
    })
  },
  xiangQing(event){
    console.log("dfsaf")
    var id=event.currentTarget.dataset.id;
    wx.setStorageSync('id', id);
    wx.navigateTo({
      url: '/pages/zhaoGongXQ/zhaoGongXQ',
    })
  }
});
